<?php
if (!init()) {
  redirect('?action=login');
}

$timeStamp = getLocalTimeStamp();

$resultSet = createNewMessage($_POST['content'], f_Date($timeStamp), f_Time($timeStamp), $_POST['did']);
if ($resultSet) {
  updateDialogAfterNewMessage($_POST['did']);
}

$initiatorAction = \controller\ControllerUtil::getEncodedActionFromUrlWithParameters($_SERVER['HTTP_REFERER']);
$initiatorAction = \controller\ControllerUtil::decodeUrl($initiatorAction);

redirect("?action=" . $initiatorAction . "#lmsg");
